<!-- 便笺 -->
<div class="span4 sort-item" rel="{$id}">
	<div class="dash-border">
		<div class="dash-title">
			<img src="__PUBLIC__/img/notepad.png" style="width:14.5px;" />&nbsp;&nbsp;{$title}&nbsp;
			<small>
				<a rel="{$id}" class="update" href="javascript:void(0)" id="update_widget"><i class="icon-pencil"></i></a> &nbsp;
				<a href="{:U('index/widget_delete', 'id='.$id)}" id="delete_widget"><i class="icon-remove"></i></a> &nbsp; 
			</small>
		</div>
		<div class="cut-line"></div>
		<textarea class="notepad" id="notepad">拼命加载中...</textarea>
	</div>
</div>
<script type="text/javascript">
	$(function () {
		$.get("{:U('log/getnotepad')}", function(data){
			$('#notepad').html(data.data);
		});

		var load_content = '';//点击时数据
		$('#notepad').focus(function(){
			load_content = $('#notepad').val();
		});
		
		$('#notepad').blur(function(){
			var note_content = $('#notepad').val();//修改后数据
			if(note_content == '' && load_content != ''){
				if(!confirm('确定要清空便笺么?')){
					$('#notepad').val(load_content);
					return true;
				}
			}
			if(load_content != note_content){
				$.ajax({
					type: "post",
					url: "{:U('log/notepad')}", 
					data: {content : note_content},
					dataType: "json",
					success : function(result){
						if(result.status != 1){
							alert('悟空跑神儿了,没有写入成功!');
						}
					}
				});
			}
		});
	});
</script>
<!-- 便笺 END-->